﻿using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace Framework.Core
{
    public class BinarySerializer : ISerializer
    {
        private static readonly BinaryFormatter BinaryFormatter = new BinaryFormatter();

        public void Serialize(object o, Stream stream)
        {
            BinaryFormatter.Serialize(stream, o);
        }

        public object Deserialize(Stream stream)
        {
            return BinaryFormatter.Deserialize(stream);
        }
    }
}
